package com.compass.doctor.dialog

import android.os.Build
import android.text.Html
import android.view.Gravity
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.fragment.app.FragmentActivity
import com.compass.doctor.databinding.DialogWithdrawExplainBinding
import com.compass.framework.base.BaseDialog
import com.compass.framework.base.BaseDialogFragment
import com.compass.framework.ext.onClick

/**
 * Description： 提现说明dialog
 * Date:2023/12/25 22:27
 */
class WithdrawExplainDialog {
    class Builder(activity: FragmentActivity,private var explain:String) : BaseDialogFragment.Builder<Builder>(activity) {


        private val mBinding: DialogWithdrawExplainBinding =
            DialogWithdrawExplainBinding.inflate(LayoutInflater.from(activity))

        init {
            initView()
        }


        private fun initView() {
            setContentView(mBinding.root)
            setWidth(ViewGroup.LayoutParams.MATCH_PARENT)
            setHeight(ViewGroup.LayoutParams.WRAP_CONTENT)
            setAnimStyle(BaseDialog.AnimStyle.BOTTOM)
            gravity = Gravity.BOTTOM

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                mBinding.tvExplain.text=Html.fromHtml(explain,Html.FROM_HTML_MODE_LEGACY)
            }else{
                mBinding.tvExplain.text=Html.fromHtml(explain)
            }

            mBinding.tvCancel.onClick {
                dismiss()
            }
        }


    }
}